/**

 * @class Extmx.AImg
 * 
 * @extends Ext.BoxComponent
 * @autor Ing. Josue Hernandez Gomez<br>
 *        joshua@extjs.mx<br>
 *        http://www.joshua.com.mx
 * @fecha 19 de octubre de 2011. DF, M&eacute;xico
 * 
 */
Ext.ns("Extmx.AImg");
Extmx.AImg=Ext.extend(Ext.BoxComponent,{
    src:"",
    pointer: true,
    initComponent: function (){

        var s= "";

        if(this.width)
            s+="width:"+this.width+"px;";

        if(this.height)
            s+="height:"+this.height+"px;";

        if(this.pointer)
            s+="cursor:pointer;";

        Ext.apply(this,{
            id: 'ahref'+this.id,
            autoEl: {
                tag: 'div',
                html:'<img src="'+this.src+'" style="'+s+'">'//width="964" height="100"
            },
            handler: function (){
                if(this.pointer)
                    this.fireEvent("click", this);
            }
        });
        
        Extmx.AImg.superclass.initComponent.apply(this,arguments);
        
        this.addEvents("click");
    },
    onRender: function (){
        Extmx.AImg.superclass.onRender.apply(this,arguments);
        
        Ext.get(this.id).on("click",this.handler.createDelegate(this.scope || this, [this], false), this.scope || this );
    },
    
    actualizar: function (obj){
        this.pointer= obj.pointer || this.pointer;
        if(obj.src)
            this.update('<img src="'+obj.src+'">');
    }
});
Ext.reg("aimg",Extmx.AImg);